package com.campus.mapper;

import com.campus.pojo.dto.StudentPageQueryDTO;
import com.campus.pojo.po.Student;
import com.campus.pojo.vo.StudentVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper {

    /**
     * 根据id查询学生信息
     * @param id
     * @return
     */
    @Select("select * from student where id = #{id}")
    public StudentVO getById(Long id);
    /**
     * 分页查询学生列表
     * @param studentPageQueryDTO
     * @return
     */
    Page<StudentVO> page(StudentPageQueryDTO studentPageQueryDTO);

    /**
     * 动态查询学生信息
     * @param student
     * @return
     */
    List<StudentVO> list(Student student);

    /**
     * 根据id删除学生信息
     * @param id
     */
    @Delete("delete from student where id = #{id}")
    void delById(Long id);

    /**
     * 更新学生信息
     * @param student
     */
    void update(Student student);

    void insert(Student student);

    @Select("select * from student where sno = #{sno}")
    Student getBySno(String sno);
}
